<template>
  <div class="playlists">
    <div class="playlists-header flex-row-between">
      <h1 class="playlists-header_title">Hot playlists</h1>
      <span @click="goToPlaylist" class="playlists-header_jump">See all</span>
    </div>
    <div class="playlists-main flex-row-between">
      <div :key="item.id" v-for="item in list" class="songlist">
        <div class="songlist-cover">
          <img class="songlist-cover_img" :src="item.picUrl" alt="" />
        </div>
        <div :title="item.name" class="songlist-name text-ellipsis">
          {{ item.name }}
        </div>
        <div class="songlist-desc">{{ item.copywriter }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from "vue-router";

export default {
  name: "HotPlaylist",
  props: {
    list: {
      type: Array,
    },
  },
  setup() {
    const router = useRouter();
    const goToPlaylist = () => {
      router.push({
        path: "/playlist",
      });
    };

    return {
      goToPlaylist,
    };
  },
};
</script>

<style lang='scss' scoped>
@import "./index.scss";
</style>